Macromedia Flex Article

Learning Flex Basics (Part 4): Working with Data Models


Table of Contents

  1. Introduction
  2. Create the Application Object and Application Layout
  3. Add the Form Controls and the DataGrid Controls
  4. Add the New Employee Model, Employee, and Location Models
  5. Instantiate the DataController Class, and Create the Employee and DataController Classes
  6. Add the DataController Methods
  7. Code Listing for data.mxml
  8. Code Listings for DataController.as and Employee.as
  9. Code Listings for locations.xml and employee.xml
  10. Where to Go From Here

Complete Code Listing for employees.xml

Note: This is a prebuilt data file; if you need to build your own copy, copy the data below into an empty text file and save it as employees.xml in the flex_tutorials directory.

<allEmployees>
	<employee>
		<fName>
			Clare
		</fName>
		<lName>
			DuPre
		</lName>
		<location>
			Paris
		</location>
	</employee>
	<employee>
		<fName>
			David
		</fName>
		<lName>
			Green
		</lName>
		<location>
			San Francisco
		</location>
	</employee>
</allEmployees>

Complete Code Listing for locations.xml

Note: this is a pre-built data file; if you need to build your own copy, copy the data below into an empty text file and save it as locations.xml in the flex_tutorials directory.

<locations>
	<location>
		Paris
	</location>
	<location>
		Tokyo
	</location>
	<location>
		Cairo
	</location>
	<location>
		San Franscisco
	</location>
</locations>